package com.tlgen.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
public class TestController {

    private Map<String, Object> map = new HashMap<>();

    @GetMapping("/info1")
    @ResponseBody
    public Map info1() {
        map.put("1", "tlgen");
        map.put("2", "谭卢钢");
        return map;
    }

    @GetMapping("/userInfo/{id}/{name}")
    @ResponseBody
    public Map userInfo(@PathVariable Integer id, @PathVariable String name) {
        map.put(String.valueOf(id), name);
        return map;
    }
}
